]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowPreview: Scale up by the same extra size for every window
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 8 Feb 2021 18:02:23 +0000 (19:02 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 19 Feb 2021 11:23:07 +0000 (11:23 +0000)
Scaling differently sized WindowPreviews by a constant factor will
result in smaller windows getting enlarged by a smaller amount of pixels
than larger windows (1000*1.02=1020 but 100*1.02=102, one will grow by
20 pixels and the other one by 2), this can look a bit weird because
smaller windows don't scale up as much as larger windows.

So introduce a constant extra size to use when scaling windows up, we
set only the half size there because we want to ensure that the size
added on both sides is not fractional and we remain aligned to the pixel
grid.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1692>

js/ui/windowPreview.js

index f4a65b620e3c1d51aab75fb4231736b97fb5b34e..25277894857b9f431ce0ea15c283a90d0e203fed 100644 (file)
@@ -13,7 +13,7 @@ var WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT = 750;
 var WINDOW_OVERLAY_FADE_TIME = 200;
 
 var WINDOW_SCALE_TIME = 200;
-var WINDOW_ACTIVE_SCALE = 1.02;
+var WINDOW_ACTIVE_SIZE_INC = 5; // in each direction
 
 var DRAGGING_WINDOW_OPACITY = 100;
 
@@ -518,9 +518,14 @@ var WindowPreview = GObject.registerClass({
             });
         });
 
+        const { width } = this._windowContainer;
+        const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
+        const activeExtraSize = WINDOW_ACTIVE_SIZE_INC * 2 * scaleFactor;
+        const scale = (width + activeExtraSize) / width;
+
         this._windowContainer.ease({
-            scale_x: WINDOW_ACTIVE_SCALE,
-            scale_y: WINDOW_ACTIVE_SCALE,
+            scale_x: scale,
+            scale_y: scale,
             duration: animate ? WINDOW_SCALE_TIME : 0,
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
         });